package com.zoe.onelink.mybatis.method;

/**
 * <p>
 * MySqlMethod 自定义方法
 * </p>
 *
 * @author fanliwen
 * @since 2/17/2020
 */
public enum SqlMethod {

  /**
   * 取最大值
   */
  MAX("max", "取最大值", "<script>\nSELECT max(${fld}) FROM %s %s %s\n</script>"),
  /**
   * 根据 @SearchField 注解字段搜索
   */
  SEARCH_LIST("searchList", "搜索满足条件所有数据", "<script>\nSELECT %s FROM %s %s %s\n</script>"),
  /**
   * 根据 @SearchField 注解字段搜索并分页
   */
  SEARCH_PAGE("searchPage", "搜索满足条件所有数据（并翻页）", "<script>\nSELECT %s FROM %s %s %s\n</script>");

  private final String method;
  private final String desc;
  private final String sql;

  SqlMethod(String method, String desc, String sql) {
    this.method = method;
    this.desc = desc;
    this.sql = sql;
  }

  public String getMethod() {
    return method;
  }

  public String getDesc() {
    return desc;
  }

  public String getSql() {
    return sql;
  }
}
